package com.mis.clothespos.inventory.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import com.mis.clothespos.inventory.service.InventoryService;
import com.mis.clothespos.inventory.mapper.*;
import com.mis.clothespos.inventory.domain.Inventory;
import com.mis.clothespos.inventory.domain.InventoryToItem;
import com.mis.clothespos.inventory.domain.InventoryItem;

import java.util.List;

@Service
@Primary
public class InventoryServiceImpl implements InventoryService {

    @Autowired
    InventoryItemMapper inventoryitemMapper;
    @Autowired
    InventoryMapper inventorymappper;
    @Autowired
    InventoryToItemMapper inventoryToItemMapper;

    @Override
    public void insertInventoryItem(InventoryItem item) {

        inventoryitemMapper.insert(item);

    }

    @Override
    public void insertInventory(Inventory inventory) {

        inventorymappper.insert(inventory);

    }

    @Override
    public void insertInventoryToItem(InventoryToItem inventoryToItem) {
        inventoryToItemMapper.insert(inventoryToItem);

    }

    @Override
    public int deleteByPrimaryKey(String id){
        return inventorymappper.deleteByPrimaryKey(id);
    }

    @Override
    public List<Inventory> selectInventory(){
        return inventorymappper.selectInventory();
    }

    @Override
    public List<InventoryItem> selectInventoryItemById(String id){
        return inventoryitemMapper.selectInventoryItemById(id);
    }
}
